package events;

import core.Post;

/**
 * This event is raised when a Post change its state.
 * 
 * @author ole
 */
public class PostStateChangedEvent extends PostEvent {
	// Class constants.
	private static final long serialVersionUID = 1L;
	
	// Class attributes.
	private Post.Post_state previous_state;

	/**
	 * Class constructor.
	 * 
	 * @param source:
	 * 		The Post that raised this event.
	 * @param prev:
	 * 		The previous state of the Post.
	 * @param actual:
	 * 		The actual state of the Post.
	 */
	public PostStateChangedEvent(Post source, Post.Post_state prev) {
		super(source);
		previous_state = prev;
	}

	/**
	 * Return the state of the Post before the event.
	 * 
	 * @return:
	 * 		A Post.Post_update value indicating the last state of the Post.
	 */
	public Post.Post_state getPreviousState() {
		return previous_state;
	}
	
	/**
	 * Return the state of the Post after the event (the actual state).
	 * 
	 * @return:
	 * 		A Post.Post_update value indicating the actual state of the Post.
	 */
	public Post.Post_state getActualState() {
		return ((Post)source).getState();
	}
}
